<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        li {
            list-style: none;
        }

        .nav a {
            padding: 0 20px;
            display: inline-block;
            height: 41px;
            font-size: 12px;
            color: #4c4c4c;
            text-decoration: none;
        }

        .nav a:hover {
            background: #eee;
            color: #ff8500;
        }

        .nav {

            height: 41px;
            border-color: #fcfcfc;
            border-top: 3px solid #ff8500;
            border-bottom: 1px solid #edeef0;
            line-height: 41px;
            /*文字居中*/

        }

        .nav-item {
            float: right;
            height: 41px;
        }

        .nav-item-item1 {
            height: 41px;
        }
    </style>

</head>

<body>
    <div id="root">
        <ul class="nav">
            <li @mouseover="mouseOver" class="nav-item" :style="">
                <a href="#">{{items[0]}}</a>
                <ul>
                    <li v-if="isShow"   class="nav-item-item1" v-for="(item2, index) in items2"
                        :key="index">
                        <a  href="#">{{item2}}</a>
                    </li>
                </ul>
            </li>

        </ul>

    </div>

    <script>
        new Vue({
            el: '#root',
            data() {
                return {
                    items: ['微博', '西瓜', '桃子'],
                    items2: ['私信', '评论', '@我'],
                    isShow: false
                }
            },
            methods: {
                mouseOver() {
                    this.isShow = true
                },
                mouseout() {
                    this.isShow = false
                }
                
            },
        })
    </script>
</body>

</html>